<template>
	<up-swiper
		height="290rpx"
		radius="20rpx"
		:list="banners"></up-swiper>
</template>

<script lang="ts" setup>
	import { ref, onMounted } from 'vue'
	import type { Banner } from '@/types/api.d.ts'

	const banners = ref<string[]>([])

	onMounted(() => {
		getBanner()
	})

	const getBanner = async () => {
		const params = { type: 1 }

		const res = await uni.$u.get<Banner[]>('/banner/index', params)

		if (res.code === 1) {
			banners.value = res.data.map((each) => each.image)
		}
	}
</script>

<style lang="scss" scoped></style>